<template>
	<view class="lg">
		<!-- <ttBar  leftIcon="icon-back" bgColor="rgba(0,0,0,0)" color="#ffffff"></ttBar> -->
		<view class="lgImgBox">
			<image class="loginBgImg" src="../../static/bg.jpg" :style="{'width':imgW+'px','height':imgH+'px'}"></image>
		</view>
		<view class="loginBg">
			<text class="loginBtn" data-url="loging" @tap="toPage">登录</text>
			<text class="regBtn" data-url="register" @tap="toPage">注册</text>
		</view>
		<updateModal ref="upModal"></updateModal>
		<downLoding></downLoding>
		<hk-modal ref="ysModal" :isCntSlot="true">
			<template v-slot:cntSlot>
				<view class="ysText">
					<text>尊敬的用户：</text>
					<view>
						欢迎使用“找培训APP”，在您使用前请仔细阅读
						<text class="zcHref" @tap="toPage" :data-url="initInfo.policy">《入驻服务协议》</text>与
						<text class="zcHref" @tap="toPage" :data-url="initInfo.privacy">《隐私政策》</text>
						，找培训将严格遵守您同意的各项条款使用您的信息，以便为您提供更好的服务。
					</view>
					<view>
						点击“同意”以为和您自愿遵守
						<text class="zcHref" @tap="toPage" :data-url="initInfo.policy">《入驻服务协议》</text>与
						<text class="zcHref" @tap="toPage" :data-url="initInfo.privacy">《隐私政策》</text>
						，找培训将严格保护您的个人信息，确保信息安全。
					</view>
				</view>
			</template>
		</hk-modal>
	</view>
</template>

<script>
	import ttBar from "@/components/ttBar/ttBar.vue";
	import downLoding from "@/components/downLoding/downLoding.vue";
	import updateModal from "@/components/updateModal/updateModal.vue";
	import hkModal from "@/components/hk-modal/hk-modal.vue";
	import {mapState} from "vuex";
	import API from "@/common/api.js";
	export default {
		components: {
			ttBar,
			downLoding,
			updateModal,
			hkModal
		},
		computed:{
			...mapState({
				initInfo:state=>state.sys.initInfo,
			})
		},
		data() {
			return {
				imgW: uni.getSystemInfoSync().screenWidth + 5,
				imgH: uni.getSystemInfoSync().screenHeight,
			};
		},
		watch:{
			initInfo(newVal){
				this.showYs()
			}
		},
		methods: {
			showYs() {
				setTimeout(() => {
					if (!uni.getStorageSync("showYs") && this.initInfo.policy) {
						this.$refs.ysModal.init({
							title: '找培训隐私政策',
							cancle: '不同意',
							confirm: '同  意',
							cntText: '',
							cancleFcn: () => {
								if(uni.getSystemInfoSync().platform=='ios'){
									plus.ios.import("UIApplication").sharedApplication().performSelector("exit")
								}else{
									plus.runtime.quit()
								}
							},
							confirmFcn: () => {
								uni.setStorageSync("showYs", true)
							}
						})
						this.$refs.ysModal.show()
					}
				}, 2000)
			}
		},
		onLoad() {
			this.showYs();
		},
		onPullDownRefresh() {
			setTimeout(() => {
				uni.stopPullDownRefresh();
			}, 1500)
		}
	}
</script>

<style lang="less">
	page {
		width: 100%;
		height: 100%;
	}

	.lgImgBox {
		position: fixed;
		width: 100%;
		height: 100%;
		display: flex;
		align-items: center;
		justify-content: center;

		.loginBgImg {
			flex-shrink: 0;
		}
	}

	.loginBg {
		position: fixed;
		right: 0;
		bottom: 90upx;
		width: 100%;
		display: flex;
		justify-content: space-between;
		z-index: 99;
		padding: 0 72upx;

		.loginBtn {
			width: 280upx;
			height: 72upx;
			border: 2upx solid #FFFFFF;
			text-align: center;
			border-radius: 38upx;
			color: #FFFFFF;
			background-color: rgba(255, 255, 255, 0.3);
			line-height: 72upx;
			font-size: 32upx;
		}

		.regBtn {
			width: 280upx;
			height: 72upx;
			border: 2upx solid #FFFFFF;
			text-align: center;
			border-radius: 38upx;
			color: #FFFFFF;
			background-color: #FFFFFF;
			line-height: 72upx;
			font-size: 32upx;
			color: #ff962e;
		}
	}

	.ysText {
		font-size: 28upx;
		color: #333333;
		padding: 18upx;
	}

	.zcHref {
		color: #ffcd11;
	}
</style>
